//
//  UIButton+Extension.swift
//  weiboCopycat
//
//  Created by Orange Yu on 2016/12/5.
//  Copyright © 2016年 Orange Yu. All rights reserved.
//

import UIKit

extension UIButton {
    
    /// 创建button的便利构造方法
    ///
    /// - Parameters:
    ///   - title: button标题
    ///   - imageName: 图片名
    ///   - backgroundImageName: 背景图片名
    convenience init(title:String,imageName:String,backgroundImageName:String) {
        self.init()
        self.setTitle(title, for: .normal)
        self.setTitleColor(UIColor.lightGray, for: .normal)
        self.titleLabel?.font = UIFont.systemFont(ofSize: 12)
        self.setImage(UIImage(named:imageName), for: .normal)
        self.setBackgroundImage(UIImage(named:backgroundImageName), for: .normal)
        self.setBackgroundImage(UIImage(named:"\(backgroundImageName)_highlighted"), for: .highlighted)
        
    }
}
